/**
 * 
 */
package view.impl;

import java.io.FileNotFoundException;

import org.newdawn.slick.SlickException;
import org.newdawn.slick.UnicodeFont;
import org.newdawn.slick.font.effects.ColorEffect;

import util.ResLoc;


/**
 * @author Julian
 *
 */
public class FontContainer {
	static private UnicodeFont menuFont = null;
	static private UnicodeFont userTextFont = null;
	static private UnicodeFont gameStatusFont = null;
	static private UnicodeFont inGameMenuFont = null;
	
	static private void initFont() throws SlickException, FileNotFoundException {
		
		menuFont = new UnicodeFont(ResLoc.getResource("MainMenu.font"), 600 / 18, false, false);				// windowHeight
		userTextFont = new UnicodeFont(ResLoc.getResource("Settings.userTextFont"), 600 / 20, false, false);
		gameStatusFont = new UnicodeFont(ResLoc.getResource("MainMenu.font"), 600 / 20, false, false);
		inGameMenuFont = new UnicodeFont(ResLoc.getResource("MainMenu.font"), 600 / 20, false, false);
		
		// Hur l�ser man warningen?
		menuFont.getEffects().add(new ColorEffect(java.awt.Color.white));
		menuFont.addAsciiGlyphs();
		
		userTextFont.getEffects().add(new ColorEffect(java.awt.Color.white));
		userTextFont.addAsciiGlyphs();
		
		gameStatusFont.getEffects().add(new ColorEffect(java.awt.Color.white));
		gameStatusFont.addAsciiGlyphs();
		
		inGameMenuFont.getEffects().add(new ColorEffect(java.awt.Color.white));
		inGameMenuFont.addAsciiGlyphs();

		menuFont.loadGlyphs();
		userTextFont.loadGlyphs();
		gameStatusFont.loadGlyphs();
		inGameMenuFont.loadGlyphs();
	}
	
	/**
	 * 
	 * Method to get the standard font to use in the main menu.
	 * 
	 * @return A UnicodeFont.
	 * @throws SlickException 
	 * @throws FileNotFoundException 
	 */
	public static UnicodeFont getMenuFont() throws SlickException, FileNotFoundException {
		if(menuFont == null) {
			initFont();
		}
		return menuFont;
	}
	
	/**
	 * 
	 * Method to get the standard font to use when the player enters a text.
	 * 
	 * @return
	 * @throws SlickException 
	 * @throws FileNotFoundException 
	 */
	static UnicodeFont getUserTextFont() throws SlickException, FileNotFoundException {
		if(userTextFont == null) {
			initFont();
		}
		return userTextFont;
	}
	
	public static UnicodeFont getGameStatusFont() throws SlickException, FileNotFoundException {
		if(gameStatusFont == null) {
			initFont();
		}
		return gameStatusFont;
	}
	
	public static UnicodeFont getInGameMenuFont() throws SlickException, FileNotFoundException {
		if(inGameMenuFont == null) {
			initFont();
		}
		return inGameMenuFont;
	}
}
